<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="file" name="file1" id="file1">
    <button id="btn">提交</button>
    <div id="imgList"></div>
</body>
<script >
    var btn = document.getElementById("btn");
    btn.onclick = function(){
        var file1 = document.getElementById("file1");
        var formData = new FormData();
        formData.append("myimg",file1.files[0]);
        fetch("http://localhost:8081/upload",{
            method:"PUT",
            body:formData
        }).then(res=>res.text())
        .then(res=>console.log(res))
    }
</script>
</html>